using System;
using System.IO;
using Common;
using Common.NotifyEvent;

namespace SSettings.SoftSetting
{
	[Serializable]
	public class CurveSetting : NotifyPropertyChanged
	{
		private double _FirstDotTimes = 4.0;

		private double _MaxYTimes = 1.1;

		private double _MinRawMinus = 2.0;

		private double _MinAmpMinus = 0.1;

		public double FirstDotTimes
		{
			get
			{
				return _FirstDotTimes;
			}
			set
			{
				if (_FirstDotTimes != value)
				{
					_FirstDotTimes = value;
					OnPropertyChanged("FirstDotTimes");
				}
			}
		}

		public double MaxYTimes
		{
			get
			{
				return _MaxYTimes;
			}
			set
			{
				if (_MaxYTimes != value)
				{
					_MaxYTimes = value;
					OnPropertyChanged("MaxYTimes");
				}
			}
		}

		public double MinRawMinus
		{
			get
			{
				return _MinRawMinus;
			}
			set
			{
				if (_MinRawMinus != value)
				{
					_MinRawMinus = value;
					OnPropertyChanged("MinRawMinus");
				}
			}
		}

		public double MinAmpMinus
		{
			get
			{
				return _MinAmpMinus;
			}
			set
			{
				if (_MinAmpMinus != value)
				{
					_MinAmpMinus = value;
					OnPropertyChanged("MinAmpMinus");
				}
			}
		}

		public void SaveToStream(StreamEx stream)
		{
			stream.Write(PropertyKey.Key_CustomImport);
		}

		public bool ReadFromStream(StreamEx stream)
		{
			PropertyKey propertyKey = stream.ReadKey();
			if (propertyKey != PropertyKey.Key_CustomImport)
			{
				return false;
			}
			while (true)
			{
				switch (stream.ReadKey())
				{
				case PropertyKey.Key_CustomImportName:
					stream.ReadBool();
					break;
				case PropertyKey.Key_AutoSaveOption:
					stream.ReadBool();
					break;
				case PropertyKey.Key_FileExt:
					stream.ReadInt();
					break;
				case PropertyKey.Key_CurverWidth:
					stream.ReadInt();
					break;
				case PropertyKey.Key_FirstDotTimes:
					stream.ReadDouble();
					break;
				case PropertyKey.Key_MaxYTimes:
					stream.ReadDouble();
					break;
				case PropertyKey.Key_MinRawMinus:
					stream.ReadDouble();
					break;
				case PropertyKey.Key_MinAmpMinus:
					stream.ReadDouble();
					break;
				default:
					stream.Seek(-4L, SeekOrigin.Current);
					return true;
				}
			}
		}
	}
}
